#include "stdio.h"
#include "math.h"
main(){
	int n,i;
	double m1,m2,m3,n1,n2,n3,r,k1,k2,k3,x,t;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf",&r);
		scanf("%lf%lf",&m1,&n1);
		scanf("%lf%lf",&m2,&n2);
		scanf("%lf%lf",&m3,&n3);
		k1=n3/m3;
		k2=n1/m1;
		t=1+k1*k2+k1;
		t/=k1*k1*k2;
		t=sqrt(t);
		x=r*t;
		printf("%.2lf\n",x*(1+k1+k1*k2)*r);
	}
}